<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.17"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Pin: Generic modification API</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">Pin
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.17 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">Generic modification API<div class="ingroups"><a class="el" href="group__API__REF.html">Instrumentation API Reference</a> &raquo; <a class="el" href="group__INS__REF.html">INS: Instruction Object</a></div></div>  </div>
</div><!--header-->
<div class="contents">
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:gaad5f037e311aa30dbc53e602e6ff672b"><td class="memItemLeft" align="right" valign="top">VOID&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__INS__MODIFICATION.html#gaad5f037e311aa30dbc53e602e6ff672b">INS_RewriteMemoryOperand</a> (INS ins, UINT32 memindex, <a class="el" href="group__REG.html#ga8f899d7ad1af070aae505a85cc998fa5">REG</a> reg)</td></tr>
<tr class="separator:gaad5f037e311aa30dbc53e602e6ff672b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga71ff91493b7499425b5efed2dcfc213b"><td class="memItemLeft" align="right" valign="top">VOID&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__INS__MODIFICATION.html#ga71ff91493b7499425b5efed2dcfc213b">INS_RewriteScatteredMemoryOperand</a> (INS ins, UINT32 memindex)</td></tr>
<tr class="separator:ga71ff91493b7499425b5efed2dcfc213b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga1441fd9383ec6d8ed2218b329eedb86c"><td class="memItemLeft" align="right" valign="top">VOID&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__INS__MODIFICATION.html#ga1441fd9383ec6d8ed2218b329eedb86c">INS_InsertIndirectJump</a> (INS ins, <a class="el" href="group__INST__ARGS.html#ga707ea08e31f44f4a81e2a7766123bad7">IPOINT</a> ipoint, <a class="el" href="group__REG.html#ga8f899d7ad1af070aae505a85cc998fa5">REG</a> reg)</td></tr>
<tr class="separator:ga1441fd9383ec6d8ed2218b329eedb86c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga5fabcfae35050a1cb92bb1c4034bab8a"><td class="memItemLeft" align="right" valign="top">VOID&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__INS__MODIFICATION.html#ga5fabcfae35050a1cb92bb1c4034bab8a">INS_InsertDirectJump</a> (INS ins, <a class="el" href="group__INST__ARGS.html#ga707ea08e31f44f4a81e2a7766123bad7">IPOINT</a> ipoint, ADDRINT tgt)</td></tr>
<tr class="separator:ga5fabcfae35050a1cb92bb1c4034bab8a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga197b096ab500acaffc6fcd5ee3b93980"><td class="memItemLeft" align="right" valign="top">VOID&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__INS__MODIFICATION.html#ga197b096ab500acaffc6fcd5ee3b93980">INS_Delete</a> (INS ins)</td></tr>
<tr class="separator:ga197b096ab500acaffc6fcd5ee3b93980"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<p>Use these functions to modify instructions. They work for all instruction sets. For experts only!</p>
<dl class="section user"><dt>Availability:</dt><dd><b>Mode:</b> JIT &amp; Probe<br  />
<b>O/S</b>: Linux &amp; Windows<br  />
<b>CPU:</b> All<br  />
</dd></dl>
<h2 class="groupheader">Function Documentation</h2>
<a id="ga197b096ab500acaffc6fcd5ee3b93980"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga197b096ab500acaffc6fcd5ee3b93980">&#9670;&nbsp;</a></span>INS_Delete()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">VOID INS_Delete </td>
          <td>(</td>
          <td class="paramtype">INS&#160;</td>
          <td class="paramname"><em>ins</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Delete the instruction</p>
<dl class="section user"><dt>Availability:</dt><dd><b>Mode:</b> JIT<br  />
<b>O/S</b>: Linux, Windows &amp; macOS*<br  />
<b>CPU:</b> All<br  />
</dd></dl>

</div>
</div>
<a id="ga5fabcfae35050a1cb92bb1c4034bab8a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga5fabcfae35050a1cb92bb1c4034bab8a">&#9670;&nbsp;</a></span>INS_InsertDirectJump()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">VOID INS_InsertDirectJump </td>
          <td>(</td>
          <td class="paramtype">INS&#160;</td>
          <td class="paramname"><em>ins</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__INST__ARGS.html#ga707ea08e31f44f4a81e2a7766123bad7">IPOINT</a>&#160;</td>
          <td class="paramname"><em>ipoint</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">ADDRINT&#160;</td>
          <td class="paramname"><em>tgt</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Insert a direct jump instruction relative to the given instruction When used with INS_Delete it can be used to emulate control transfer instructions.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">ins</td><td>input instruction </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">ipoint</td><td>location relative to ins (only IPOINT_BEFORE and IPOINT_AFTER are supported) </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">tgt</td><td>absolute address of the target</td></tr>
  </table>
  </dd>
</dl>
<dl class="section user"><dt>Availability:</dt><dd><b>Mode:</b> JIT<br  />
<b>O/S</b>: Linux, Windows &amp; macOS*<br  />
<b>CPU:</b> IA-32 and Intel(R) 64 architectures<br  />
</dd></dl>

</div>
</div>
<a id="ga1441fd9383ec6d8ed2218b329eedb86c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga1441fd9383ec6d8ed2218b329eedb86c">&#9670;&nbsp;</a></span>INS_InsertIndirectJump()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">VOID INS_InsertIndirectJump </td>
          <td>(</td>
          <td class="paramtype">INS&#160;</td>
          <td class="paramname"><em>ins</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__INST__ARGS.html#ga707ea08e31f44f4a81e2a7766123bad7">IPOINT</a>&#160;</td>
          <td class="paramname"><em>ipoint</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__REG.html#ga8f899d7ad1af070aae505a85cc998fa5">REG</a>&#160;</td>
          <td class="paramname"><em>reg</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Insert an indirect jump instruction relative to the given instruction. When used with INS_Delete it can be used to emulate control transfer instructions.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">ins</td><td>input instruction </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">ipoint</td><td>location relative to ins (only IPOINT_BEFORE and IPOINT_AFTER are supported) </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">reg</td><td>register holding the target</td></tr>
  </table>
  </dd>
</dl>
<dl class="section user"><dt>Availability:</dt><dd><b>Mode:</b> JIT<br  />
<b>O/S</b>: Linux, Windows &amp; macOS*<br  />
<b>CPU:</b> IA-32 and Intel(R) 64 architectures<br  />
</dd></dl>

</div>
</div>
<a id="gaad5f037e311aa30dbc53e602e6ff672b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaad5f037e311aa30dbc53e602e6ff672b">&#9670;&nbsp;</a></span>INS_RewriteMemoryOperand()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">VOID INS_RewriteMemoryOperand </td>
          <td>(</td>
          <td class="paramtype">INS&#160;</td>
          <td class="paramname"><em>ins</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">UINT32&#160;</td>
          <td class="paramname"><em>memindex</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__REG.html#ga8f899d7ad1af070aae505a85cc998fa5">REG</a>&#160;</td>
          <td class="paramname"><em>reg</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Change this memory access instruction to reference the virtual memory location contained in the given register.<br  />
This function will generate an error for memory operands with scattered access, i.e. vgather/vscatter. In this case use <a class="el" href="group__INS__MODIFICATION.html#ga71ff91493b7499425b5efed2dcfc213b">INS_RewriteScatteredMemoryOperand</a> instead.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">ins</td><td>input instruction </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">memopIdx</td><td>controls which memory operand to rewrite (0,1,...) </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">newBase</td><td>register containing the base address of the new operand which will normally be a scratch register allocated via <a class="el" href="group__REG.html#gaf2783ea9f9f0e98c0645055b2aa368b3">PIN_ClaimToolRegister()</a></td></tr>
  </table>
  </dd>
</dl>
<p>On IA-32 and Intel64, the modified operand uses only base register addressing with the new base register <em>newBase</em>. Any index, scale, or offset fields from that operand in the original instruction are removed. In addition, if the original instruction's operand uses a segment override, the instruction is changed to use the default segment.</p>
<p>This function can be used to rewrite memory operands even when they are implicit (for instance call, ret, push, pop), though in this case the instruction may ultimately be replaced by a sequence of instructions which achieve the same effect. (This is transparent to instrumentation, which continues to see the original instruction).</p>
<p>The only instruction which cannot be rewritten is <b>enter</b> with a second operand &gt; 0.</p>
<p>Note that the address in <em>newBase</em> is always the lowest address which will be accessed by this operand. This is consistent with the way in which Pin returns addresses in IARG_*_EA, but means that if the operand is modified by the instruction before the memory access occurs (for instance a <b>push</b> instruction), the value in <em>newBase</em> will not be the value in the stack pointer, but the address of the memory which is accessed by the instruction.</p>
<p>This can also be confusing for xlat; where the value of <em>newBase</em> is the address from which data is loaded, not the address of the base of the translation table. (Again, this is consistent with the IARG_*_EA which Pin will report for an xlat operation).</p>
<p>Similarly for the bt,btc,btr and bts insructions, if the bit index is larger than the operand size (so that parts of the bit index affect the EA), they are included in Pin's normal EA calculation. In this case, Pin automatically masks the bit index operand so that it only includes the index within the addressed unit of memory. This ensures that your address manipulation function need only consider the translation of the EA, it does not have to worry about additional offsets generated by the bit index operand of these instructions. (This is equivalent to saying that if you replace all memory operands, but use an address computation function that simply returns the original EA, the code will continue to execute correctly).</p>
<h3><a class="anchor" id="CO"></a>
Call order</h3>
<p>Please note the analysis routine that is used for setting the rewritten address must be called last among all the IPOINT_BEFORE analysis routines for this instruction (IARG_CALL_ORDER, CALL_ORDER_LAST). The reason is so that the register used to store the rewritten address will not get accidentally rewritten with another value by another analysis routine. The actual rewrite happens just before executing the instruction, so the value of the register containing the rewritten address must remain intact.</p>
<p>The canonical instrumentation code for memory address rewriting now looks something like this </p><div class="fragment"><div class="line"><span class="comment">// Map the originalEa to a translated address.</span></div>
<div class="line"><span class="keyword">static</span> ADDRINT ProcessAddress(ADDRINT originalEa, ADDRINT size, UINT32 access);</div>
<div class="line">...</div>
<div class="line">   <span class="keywordflow">for</span> (UINT32 op = 0; op&lt;<a class="code" href="group__INS__INSPECTION.html#gaa01f153aa19aeb478458cf2042d05a01">INS_MemoryOperandCount</a>(ins); op++)</div>
<div class="line">   {</div>
<div class="line">       UINT32 access = (<a class="code" href="group__INS__INSPECTION.html#ga2db1205b7749b176d9145d911bad461c">INS_MemoryOperandIsRead</a>(ins,op)    ? 1 : 0) |</div>
<div class="line">                       (<a class="code" href="group__INS__INSPECTION.html#gab66a50260dde64035e46a831f5d4b1dc">INS_MemoryOperandIsWritten</a>(ins,op) ? 2 : 0);</div>
<div class="line"> </div>
<div class="line">       <a class="code" href="group__INS__INSTRUMENTATION.html#gaea02f152d3515f4758b8f979a380da09">INS_InsertCall</a>(ins, <a class="code" href="group__INST__ARGS.html#gga707ea08e31f44f4a81e2a7766123bad7a7c7cbebb7a62a40e9f803b1db2e6ce20">IPOINT_BEFORE</a>,</div>
<div class="line">                      AFUNPTR(ProcessAddress),</div>
<div class="line">                      <a class="code" href="group__INST__ARGS.html#gga089c27ca15e9ff139dd3a3f8a6f8451da985747a3c70e3a4283fc8a2f16399e63">IARG_MEMORYOP_EA</a>,   op,</div>
<div class="line">                      <a class="code" href="group__INST__ARGS.html#gga089c27ca15e9ff139dd3a3f8a6f8451daa5b738f4179d2b6313ac517be1f5221d">IARG_MEMORYOP_SIZE</a>, op,</div>
<div class="line">                      <a class="code" href="group__INST__ARGS.html#gga089c27ca15e9ff139dd3a3f8a6f8451dabd19b79248899659441e56e4738d5bfd">IARG_UINT32</a>,        access,</div>
<div class="line">                      <a class="code" href="group__INST__ARGS.html#gga089c27ca15e9ff139dd3a3f8a6f8451da6c8569ef37241134ffc6e24593275981">IARG_RETURN_REGS</a>,   <a class="code" href="group__REG.html#gga8f899d7ad1af070aae505a85cc998fa5a11e08c4721381099b1fbabb5ba2c255a">REG_INST_G0</a>+i,</div>
<div class="line">                      <a class="code" href="group__INST__ARGS.html#gga089c27ca15e9ff139dd3a3f8a6f8451da45b6bfd69845ada4a0875967995ad7c6">IARG_CALL_ORDER</a>,    <a class="code" href="group__INST__ARGS.html#gga3d1d5f6805cb16d00bce441290ca2212a0b197a15a2399e6443ce6be187ccf6c6">CALL_ORDER_LAST</a>,</div>
<div class="line">                      IARG_END);</div>
<div class="line"> </div>
<div class="line">       <a class="code" href="group__INS__MODIFICATION.html#gaad5f037e311aa30dbc53e602e6ff672b">INS_RewriteMemoryOperand</a>(ins, i, <a class="code" href="group__REG.html#ga8f899d7ad1af070aae505a85cc998fa5">REG</a>(<a class="code" href="group__REG.html#gga8f899d7ad1af070aae505a85cc998fa5a11e08c4721381099b1fbabb5ba2c255a">REG_INST_G0</a>+i));</div>
<div class="line">   }</div>
</div><!-- fragment --><p> There is no need to handle any instructions specially.</p>
<dl class="section user"><dt>Availability:</dt><dd><b>Mode:</b> JIT<br  />
<b>O/S</b>: Linux, Windows &amp; macOS*<br  />
<b>CPU:</b> IA-32 and Intel(R) 64 architectures<br  />
</dd></dl>

</div>
</div>
<a id="ga71ff91493b7499425b5efed2dcfc213b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga71ff91493b7499425b5efed2dcfc213b">&#9670;&nbsp;</a></span>INS_RewriteScatteredMemoryOperand()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">VOID INS_RewriteScatteredMemoryOperand </td>
          <td>(</td>
          <td class="paramtype">INS&#160;</td>
          <td class="paramname"><em>ins</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">UINT32&#160;</td>
          <td class="paramname"><em>memindex</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Change this memory access instruction to reference the virtual memory location previously configured by an analysis routine. This function is supported only for memory operands with scattered access (vscatter/vgather), and will generate an error for all other instructions. For other instructions use <a class="el" href="group__INS__MODIFICATION.html#gaad5f037e311aa30dbc53e602e6ff672b">INS_RewriteMemoryOperand</a> instead. <br  />
Call <a class="el" href="group__INS__INSPECTION.html#gad1ade5b21d590fd2a53b6e98a835c553">INS_HasScatteredMemoryAccess</a> to check if this function can be used for an instruction.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">ins</td><td>input instruction </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">memopIdx</td><td>controls which memory operand to rewrite (0,1,...)</td></tr>
  </table>
  </dd>
</dl>
<p>In order to rewrite a vscatter/vgather memory operand, two calls are required: <br  />
(1) A call to this function <br  />
(2) An IPOINT_BEFORE analysis routine with <a class="el" href="group__INST__ARGS.html#gga089c27ca15e9ff139dd3a3f8a6f8451daf366ff3d1e14bc23162ad18c47b63c1f">IARG_REWRITE_SCATTERED_MEMOP</a> that will set the new addresses. <br  />
If (1) is missing then the (2) will still execute as it may perform other tasks other than rewrite. <br  />
However no rewrite will be executed and the addresses set by the analysis routine will not be used. <br  />
If (2) is missing then there will be no rewrite.</p>
<p>The canonical instrumentation code for scattered access memory rewriting now looks something like this </p><div class="fragment"><div class="line"> <span class="comment">// In instrumentation callback</span></div>
<div class="line">...</div>
<div class="line">if (<a class="code" href="group__INS__INSPECTION.html#gad1ade5b21d590fd2a53b6e98a835c553">INS_HasScatteredMemoryAccess</a>(ins))</div>
<div class="line">{</div>
<div class="line">    <span class="keywordflow">for</span> (UINT32 op = 0; op&lt;<a class="code" href="group__INS__INSPECTION.html#gaa01f153aa19aeb478458cf2042d05a01">INS_MemoryOperandCount</a>(ins); op++)</div>
<div class="line">    {</div>
<div class="line">        <a class="code" href="group__INS__INSTRUMENTATION.html#gaea02f152d3515f4758b8f979a380da09">INS_InsertCall</a>(ins, <a class="code" href="group__INST__ARGS.html#gga707ea08e31f44f4a81e2a7766123bad7a7c7cbebb7a62a40e9f803b1db2e6ce20">IPOINT_BEFORE</a>,</div>
<div class="line">                       (AFUNPTR)DoRewrite, </div>
<div class="line">                       <a class="code" href="group__INST__ARGS.html#gga089c27ca15e9ff139dd3a3f8a6f8451daf366ff3d1e14bc23162ad18c47b63c1f">IARG_REWRITE_SCATTERED_MEMOP</a>, op, </div>
<div class="line">                       IARG_END);</div>
<div class="line"> </div>
<div class="line">        <a class="code" href="group__INS__MODIFICATION.html#ga71ff91493b7499425b5efed2dcfc213b">INS_RewriteScatteredMemoryOperand</a>(ins, op);</div>
<div class="line">    }</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"><span class="comment">// Rewrite analysis routine</span></div>
<div class="line"><span class="keyword">static</span> VOID DoRewrite(<a class="code" href="classISCATTERED__MEMORY__REWRITE.html">ISCATTERED_MEMORY_REWRITE</a>* memRewrite)</div>
<div class="line">{</div>
<div class="line">    <span class="keywordflow">for</span> (UINT32 i = 0; i &lt; memRewrite-&gt;<a class="code" href="classISCATTERED__MEMORY__REWRITE.html#ad98e8ac391d205490dbe82b2a61c095b">NumOfElements</a>(); i++)</div>
<div class="line">    {</div>
<div class="line">        ADDRINT newAddr = ...</div>
<div class="line">        memRewrite-&gt;<a class="code" href="classISCATTERED__MEMORY__REWRITE.html#a1d1b078dd4182756879319faa0f8e5e0">SetElementAddress</a>(i, newAddr);</div>
<div class="line">    }</div>
<div class="line">}</div>
</div><!-- fragment --><dl class="section user"><dt>Availability:</dt><dd><b>Mode:</b> JIT<br  />
<b>O/S</b>: Linux, Windows &amp; macOS*<br  />
<b>CPU:</b> IA-32 and Intel(R) 64 architectures<br  />
</dd></dl>

</div>
</div>
</div><!-- contents -->
<div class="ttc" id="aclassISCATTERED__MEMORY__REWRITE_html_a1d1b078dd4182756879319faa0f8e5e0"><div class="ttname"><a href="classISCATTERED__MEMORY__REWRITE.html#a1d1b078dd4182756879319faa0f8e5e0">ISCATTERED_MEMORY_REWRITE::SetElementAddress</a></div><div class="ttdeci">virtual VOID SetElementAddress(UINT32 element_index, ADDRINT address)=0</div></div>
<div class="ttc" id="agroup__INST__ARGS_html_gga089c27ca15e9ff139dd3a3f8a6f8451da45b6bfd69845ada4a0875967995ad7c6"><div class="ttname"><a href="group__INST__ARGS.html#gga089c27ca15e9ff139dd3a3f8a6f8451da45b6bfd69845ada4a0875967995ad7c6">IARG_CALL_ORDER</a></div><div class="ttdeci">@ IARG_CALL_ORDER</div><div class="ttdoc">Type: CALL_ORDER. Determine order of analysis calls. See CALL_ORDER.</div><div class="ttdef"><b>Definition:</b> types_vmapi.PH:473</div></div>
<div class="ttc" id="agroup__INS__INSPECTION_html_ga2db1205b7749b176d9145d911bad461c"><div class="ttname"><a href="group__INS__INSPECTION.html#ga2db1205b7749b176d9145d911bad461c">INS_MemoryOperandIsRead</a></div><div class="ttdeci">BOOL INS_MemoryOperandIsRead(INS ins, UINT32 memopIdx)</div></div>
<div class="ttc" id="agroup__INST__ARGS_html_gga089c27ca15e9ff139dd3a3f8a6f8451daa5b738f4179d2b6313ac517be1f5221d"><div class="ttname"><a href="group__INST__ARGS.html#gga089c27ca15e9ff139dd3a3f8a6f8451daa5b738f4179d2b6313ac517be1f5221d">IARG_MEMORYOP_SIZE</a></div><div class="ttdeci">@ IARG_MEMORYOP_SIZE</div><div class="ttdoc">Type: UINT32. Size of a memory op (memory op index is next arg)</div><div class="ttdef"><b>Definition:</b> types_vmapi.PH:480</div></div>
<div class="ttc" id="agroup__INS__MODIFICATION_html_gaad5f037e311aa30dbc53e602e6ff672b"><div class="ttname"><a href="group__INS__MODIFICATION.html#gaad5f037e311aa30dbc53e602e6ff672b">INS_RewriteMemoryOperand</a></div><div class="ttdeci">VOID INS_RewriteMemoryOperand(INS ins, UINT32 memindex, REG reg)</div></div>
<div class="ttc" id="agroup__INST__ARGS_html_gga089c27ca15e9ff139dd3a3f8a6f8451da985747a3c70e3a4283fc8a2f16399e63"><div class="ttname"><a href="group__INST__ARGS.html#gga089c27ca15e9ff139dd3a3f8a6f8451da985747a3c70e3a4283fc8a2f16399e63">IARG_MEMORYOP_EA</a></div><div class="ttdeci">@ IARG_MEMORYOP_EA</div><div class="ttdoc">Type: ADDRINT. Effective address of a memory op (memory op index is next arg); only valid at IPOINT_B...</div><div class="ttdef"><b>Definition:</b> types_vmapi.PH:479</div></div>
<div class="ttc" id="agroup__INS__INSPECTION_html_gab66a50260dde64035e46a831f5d4b1dc"><div class="ttname"><a href="group__INS__INSPECTION.html#gab66a50260dde64035e46a831f5d4b1dc">INS_MemoryOperandIsWritten</a></div><div class="ttdeci">BOOL INS_MemoryOperandIsWritten(INS ins, UINT32 memopIdx)</div></div>
<div class="ttc" id="agroup__INST__ARGS_html_gga089c27ca15e9ff139dd3a3f8a6f8451daf366ff3d1e14bc23162ad18c47b63c1f"><div class="ttname"><a href="group__INST__ARGS.html#gga089c27ca15e9ff139dd3a3f8a6f8451daf366ff3d1e14bc23162ad18c47b63c1f">IARG_REWRITE_SCATTERED_MEMOP</a></div><div class="ttdeci">@ IARG_REWRITE_SCATTERED_MEMOP</div><div class="ttdef"><b>Definition:</b> types_vmapi.PH:339</div></div>
<div class="ttc" id="agroup__INS__MODIFICATION_html_ga71ff91493b7499425b5efed2dcfc213b"><div class="ttname"><a href="group__INS__MODIFICATION.html#ga71ff91493b7499425b5efed2dcfc213b">INS_RewriteScatteredMemoryOperand</a></div><div class="ttdeci">VOID INS_RewriteScatteredMemoryOperand(INS ins, UINT32 memindex)</div></div>
<div class="ttc" id="aclassISCATTERED__MEMORY__REWRITE_html_ad98e8ac391d205490dbe82b2a61c095b"><div class="ttname"><a href="classISCATTERED__MEMORY__REWRITE.html#ad98e8ac391d205490dbe82b2a61c095b">ISCATTERED_MEMORY_REWRITE::NumOfElements</a></div><div class="ttdeci">virtual UINT32 NumOfElements() const =0</div></div>
<div class="ttc" id="aclassISCATTERED__MEMORY__REWRITE_html"><div class="ttname"><a href="classISCATTERED__MEMORY__REWRITE.html">ISCATTERED_MEMORY_REWRITE</a></div><div class="ttdef"><b>Definition:</b> types_vmapi.PH:1134</div></div>
<div class="ttc" id="agroup__INST__ARGS_html_gga089c27ca15e9ff139dd3a3f8a6f8451da6c8569ef37241134ffc6e24593275981"><div class="ttname"><a href="group__INST__ARGS.html#gga089c27ca15e9ff139dd3a3f8a6f8451da6c8569ef37241134ffc6e24593275981">IARG_RETURN_REGS</a></div><div class="ttdeci">@ IARG_RETURN_REGS</div><div class="ttdoc">Register to write analysis function return value (additional register arg required)....</div><div class="ttdef"><b>Definition:</b> types_vmapi.PH:471</div></div>
<div class="ttc" id="agroup__REG_html_gga8f899d7ad1af070aae505a85cc998fa5a11e08c4721381099b1fbabb5ba2c255a"><div class="ttname"><a href="group__REG.html#gga8f899d7ad1af070aae505a85cc998fa5a11e08c4721381099b1fbabb5ba2c255a">REG_INST_G0</a></div><div class="ttdeci">@ REG_INST_G0</div><div class="ttdoc">Scratch register used in pintools.</div><div class="ttdef"><b>Definition:</b> reg_ia32.PH:535</div></div>
<div class="ttc" id="agroup__INS__INSPECTION_html_gad1ade5b21d590fd2a53b6e98a835c553"><div class="ttname"><a href="group__INS__INSPECTION.html#gad1ade5b21d590fd2a53b6e98a835c553">INS_HasScatteredMemoryAccess</a></div><div class="ttdeci">BOOL INS_HasScatteredMemoryAccess(INS ins)</div></div>
<div class="ttc" id="agroup__INST__ARGS_html_gga3d1d5f6805cb16d00bce441290ca2212a0b197a15a2399e6443ce6be187ccf6c6"><div class="ttname"><a href="group__INST__ARGS.html#gga3d1d5f6805cb16d00bce441290ca2212a0b197a15a2399e6443ce6be187ccf6c6">CALL_ORDER_LAST</a></div><div class="ttdeci">@ CALL_ORDER_LAST</div><div class="ttdoc">Execute this call last. Value is 300.</div><div class="ttdef"><b>Definition:</b> types_vmapi.PH:204</div></div>
<div class="ttc" id="agroup__INS__INSTRUMENTATION_html_gaea02f152d3515f4758b8f979a380da09"><div class="ttname"><a href="group__INS__INSTRUMENTATION.html#gaea02f152d3515f4758b8f979a380da09">INS_InsertCall</a></div><div class="ttdeci">VOID INS_InsertCall(INS ins, IPOINT action, AFUNPTR funptr,...)</div></div>
<div class="ttc" id="agroup__INS__INSPECTION_html_gaa01f153aa19aeb478458cf2042d05a01"><div class="ttname"><a href="group__INS__INSPECTION.html#gaa01f153aa19aeb478458cf2042d05a01">INS_MemoryOperandCount</a></div><div class="ttdeci">UINT32 INS_MemoryOperandCount(INS ins)</div></div>
<div class="ttc" id="agroup__INST__ARGS_html_gga707ea08e31f44f4a81e2a7766123bad7a7c7cbebb7a62a40e9f803b1db2e6ce20"><div class="ttname"><a href="group__INST__ARGS.html#gga707ea08e31f44f4a81e2a7766123bad7a7c7cbebb7a62a40e9f803b1db2e6ce20">IPOINT_BEFORE</a></div><div class="ttdeci">@ IPOINT_BEFORE</div><div class="ttdoc">Insert a call before the first instruction of the instrumented object. Always valid.</div><div class="ttdef"><b>Definition:</b> types_vmapi.PH:135</div></div>
<div class="ttc" id="agroup__INST__ARGS_html_gga089c27ca15e9ff139dd3a3f8a6f8451dabd19b79248899659441e56e4738d5bfd"><div class="ttname"><a href="group__INST__ARGS.html#gga089c27ca15e9ff139dd3a3f8a6f8451dabd19b79248899659441e56e4738d5bfd">IARG_UINT32</a></div><div class="ttdeci">@ IARG_UINT32</div><div class="ttdoc">Type: UINT32. Constant (additional integer arg required)</div><div class="ttdef"><b>Definition:</b> types_vmapi.PH:218</div></div>
<div class="ttc" id="agroup__REG_html_ga8f899d7ad1af070aae505a85cc998fa5"><div class="ttname"><a href="group__REG.html#ga8f899d7ad1af070aae505a85cc998fa5">REG</a></div><div class="ttdeci">REG</div><div class="ttdef"><b>Definition:</b> reg_ia32.PH:18</div></div>
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.17
</small></address>
</body>
</html>
